import axios from 'axios'

export function request(config) {
    const instance = axios.create({
        baseURL: '',
        timeout: 5000
    })
    instance.interceptors.request.use(config => {
        return config
    }, err => {
        Promise.reject();
    })

    instance.interceptors.response.use(res => {
        if (res.status === 200) {
            return res.data;
        }
        else {
            Promise.reject();
        }
    },err => {
        console.log(err);
        return Promise.reject();
    })
    return instance(config)
}